package rmaqlc31.basic;

public class J15_Retangle {

	public static void main(String[] args) {
		
		Retangle1ServiceImpl rsrv = new Retangle1ServiceImpl();
		
		Retangle1 r = new Retangle1(4, 40, "red");
		
		r.setGetArea(rsrv.getgetArea(r));
		r.setGetCircum(rsrv.getgetCircum(r));
		
		System.out.println(r.toString());
		
	}

}

interface Retangle1Service {
	
	double getgetArea(Retangle1 r);
	double getgetCircum(Retangle1 r);
	
}

class Retangle1ServiceImpl implements Retangle1Service{

	@Override
	public double getgetArea(Retangle1 r) {
		double getArea = r.getWidth()*r.getHeight();
		return getArea;
	}

	@Override
	public double getgetCircum(Retangle1 r) {
		double getCircum = (r.getWidth()+r.getHeight())*2;
		return getCircum;
	}
	
}


class Retangle1 {
	private double width;
	private double height;
	private String color;
	private double getArea;
	private double getCircum;
	
	public Retangle1() {}

	public Retangle1(double width, double height, String color) {
		super();
		this.width = width;
		this.height = height;
		this.color = color;
	}

	public double getWidth() {
		return width;
	}

	public void setWidth(double width) {
		this.width = width;
	}

	public double getHeight() {
		return height;
	}

	public void setHeight(double height) {
		this.height = height;
	}

	public String getColor() {
		return color;
	}

	public void setColor(String color) {
		this.color = color;
	}

	public double getGetArea() {
		return getArea;
	}

	public void setGetArea(double getArea) {
		this.getArea = getArea;
	}

	public double getGetCircum() {
		return getCircum;
	}

	public void setGetCircum(double getCircum) {
		this.getCircum = getCircum;
	}

	@Override
	public String toString() {
		return "Retangle1 [width=" + width + ", height=" + height + ", color="
				+ color + ", getArea=" + getArea + ", getCircum=" + getCircum
				+ "]";
	}
	
	
}


